package com.mmd.manage.task;

import com.mmd.common.entity.MmdOrder;
import com.mmd.manage.dao.MmdOrderDao;
import com.mmd.manage.service.PullLogisticsInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author cyq
 * @Date 2019/10/8 23:02
 * @Description
 **/
@Component("pullLogisticsInfoTaskJob")
@EnableScheduling
public class PullLogisticsInfoTask {
    private static final Logger logger = LoggerFactory.getLogger(PullLogisticsInfoTask.class);
    @Autowired
    private PullLogisticsInfoService pullLogisticsInfoService;

    @Autowired
    private MmdOrderDao mmdOrderDao;

//    @Scheduled(cron = "0 0/1 * * * ? ")
    @Scheduled(cron = "0 0 0/2 * * ? ")
    public void pullLogistics(){
        List<MmdOrder> list = mmdOrderDao.selectNoSign();
        for (MmdOrder order : list) {
            pullLogisticsInfoService.pull(order);
        }
    }
}
